<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of block_myguestbook_editable_form
 *
 * @author dmitriev
 */
require_once("$CFG->libdir/formslib.php");

class block_myguestbook_editable_form extends moodleform {

    protected function definition() {
        $mform = $this->_form;
        $course = $this->_customdata['course'];

        // Храним id
        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        // Храним информацию о том, с чем работает: изменяем сообщение или оставляем комментарий
        $mform->addElement('hidden', 'type');
        $mform->setType('type', PARAM_TEXT);
        
        $elementgroup = array();
        $elementgroup[] = $mform->createElement('text', 'name', '', array('size' => '20', 'maxlength' => '120'));
        $mform->setType('name', PARAM_TEXT);

        $mform->addGroup($elementgroup, 'name_group', get_string('name', 'block_myguestbook'), ' ', false);

        $mform->addElement('textarea', 'message', get_string('messagesname', 'block_myguestbook'),
                'wrap="virtual" rows="5", cols="100"');

        $mform->setType('message', PARAM_TEXT);

        $this->add_action_buttons(true, get_string('send', 'block_myguestbook'));
    }
}
